#include <cstdarg>
#include <ctime>
#include <chrono>
#include <sstream>
#include "logger.h"

#define LOGGER_PREFIX "[ocean-vagsdk-jni]"

void PrintLog(const char *fmt, ...) {
    using std::chrono::system_clock;
    auto currentTime = system_clock::now();
    char buffer[32];

    std::time_t tt;
    tt = system_clock::to_time_t ( currentTime );
    auto tInfo = localtime (&tt);
    strftime (buffer, sizeof(buffer),"%FT%H:%M:%S%Z",tInfo);
    std::stringstream ss;
    ss
            << LOGGER_PREFIX << " "
            << "[" << buffer << "]"
            << " "
            << fmt;

    va_list args;
    va_start(args, fmt);
    vprintf(ss.str().c_str(), args);
    va_end(args);
}
